Display appropriate message for trigger fire when 204 is returned#311
Display appropriate message for trigger fire when 204 is returned#311dubee wants to merge 2 commits intoapache:masterfrom
Conversation
598219f to
b83acb7
Compare
commands/trigger.go
Outdated
| return werr | ||
| } | ||
|
|
||
| if resp.StatusCode == 204 { |
There was a problem hiding this comment.
if resp.StatusCode == http.StatusNoContent {
wski18n/resources/en_US.all.json
Outdated
| "translation": "{{.ok}} triggered /{{.namespace}}/{{.name}} with id {{.id}}\n" | ||
| }, | ||
| { | ||
| "id": "trigger /{{.namespace}}/{{.name}} did not fire as it is not associated with an active rule(s)\n", |
There was a problem hiding this comment.
i think rules(s) can be changed to rule. only one active rule is needed.
| } | ||
|
|
||
| val rr = wsk.trigger.fire(triggerName) | ||
| val ns = wsk.namespace.whois() |
| "namespace": boldString(qualifiedName.GetNamespace()), | ||
| "name": boldString(qualifiedName.GetEntityName())})) | ||
|
|
||
| return nil |
There was a problem hiding this comment.
up for discussion... is this situation considered an error (i.e. non-zero exit code, stderr)?
There was a problem hiding this comment.
@mdeuser, I believe we agreed to return a non-zero exit code here.
There was a problem hiding this comment.
@dubee yeah.. that's what you and i agreed upon. was looking if anyone had an opposite argument :-)
There was a problem hiding this comment.
which exit code would you return?
|
|
||
| if resp.StatusCode == http.StatusNoContent { | ||
| fmt.Fprintf(color.Output, | ||
| wski18n.T("trigger /{{.namespace}}/{{.name}} did not fire as it is not associated with an active rule\n", |
There was a problem hiding this comment.
I suggest for all new message and to start transitioning these message ids to constants - see for example baa07f0.
| return werr | ||
| } | ||
|
|
||
| if resp.StatusCode == http.StatusNoContent { |
There was a problem hiding this comment.
I suggest starting to add go unit tests as well for such changes as it will vector toward better factoring of the code. For example a unit test that mocks an HTTP response and confirms returning the expected message and CLI code.
bb32c44 to
3031300
Compare
When a trigger without active or associated rule(s) is fired, an activation ID is not returned from an OpenWhisk server. These changes display an appropriate message when such an scenario occurs.
Closes #301